function add(x:number, y: number): number {
  return x + y;
}

let myAdd = function(x: number, y: number): number {
  return x + y;
}

//可选参数
function buildName(firstName: string, lastName?: string) {
  if(lastName) {
    return firstName + "·" + lastName;
  }
  else {
    return firstName;
  }
}

let result1 = buildName("Bob");
// let result2 = buildName("Bob","Adams","Sr.");
let result3 = buildName("Bob","Adams");

function buildNameV2(firstName: string, ...restOfName: string[]) {
  return firstName + " " + restOfName.join("-")
}

let employeeName = buildNameV2("Joseph", "Samuel", "Lucas", "MacKinzie");
console.log(employeeName)

let buildNameFun: (firstName: string, ...restOfName: string[]) => string = buildNameV2;